package com.nwpu.am.mapper;

import com.nwpu.am.pojo.dto.PartFindDTO;
import org.apache.ibatis.annotations.*;
import com.nwpu.am.pojo.entity.*;

import java.util.ArrayList;

@Mapper
public interface PartMapper {
    @Insert("INSERT INTO tb_part (part_id, part_name, part_num, price, warehouse_id) VALUES (#{partId}, #{partName}, #{partNum}, #{price}, #{warehouseId})")
    Part insertPart(Part part);

    @Select("SELECT * FROM tb_part WHERE part_id = #{partId}")
    Part selectPartById(int partId);
    @Select("SELECT * FROM tb_part WHERE part_name = #{partName}")
    ArrayList<Part> selectPartByName(String partName);
    int updatePart(Part part);

    @Delete("DELETE FROM tb_part WHERE part_id = #{partId}")
    int deletePartById(int partId);

    ArrayList<Part> selectPartByPartFindDTO(PartFindDTO partFindDTO);
    @Select("SELECT * FROM tb_part")
    ArrayList<Part> selectAll();


}
